//
//  SAVipManagementCell.m
//  saasRetail
//
//  Created by 黄志刚 on 2021/6/24.
//

#import "SAVipManagementCell.h"
#import "SAMemberListModel.h"

@interface SAVipManagementCell ()

@property (nonatomic, strong) UIImageView *imageV;
@property (nonatomic, strong) UILabel *nameLab;
@property (nonatomic, strong) UILabel *levelLab;
@property (nonatomic, strong) UILabel *iphoneLab;
@property (nonatomic, strong) UIImageView *allowImageV;
@property (nonatomic, strong) UIImageView *birthdayImageV;

@end

@implementation SAVipManagementCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initUI];
    }
    return self;
}

-(void)setModel:(SAMemberListModel *)model {
    _model = model;
    self.nameLab.text = model.memberName;
    self.levelLab.text = model.memberLevelStr;
    self.iphoneLab.text = model.mobile;
    self.birthdayImageV.hidden = [model.isBirthday isEqualToString:@"0"];
}

-(void)initUI {
    self.backgroundColor = [UIColor whiteColor];
    
    [self.contentView addSubview:self.imageV];
    [self.contentView addSubview:self.nameLab];
    [self.contentView addSubview:self.levelLab];
    [self.contentView addSubview:self.iphoneLab];
    [self.contentView addSubview:self.allowImageV];
    [self.contentView addSubview:self.birthdayImageV];
}

#pragma mark - lazy
-(UIImageView *)imageV {
    if (!_imageV) {
        _imageV = [[UIImageView alloc] initWithFrame:SARectMake(30, 16, 38, 38)];
        _imageV.userInteractionEnabled = YES;
        _imageV.image = [UIImage imageNamed:@"user_headerImage"];
        _imageV.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _imageV;
}

-(UILabel *)nameLab {
    if (!_nameLab) {
        _nameLab = [[UILabel alloc] initWithFrame:SARectMake(85, 5, 150, 20)];
        _nameLab.textColor = kBlackColor;
        _nameLab.font = kFont(13);
    }
    return _nameLab;
}

-(UILabel *)levelLab {
    if (!_levelLab) {
        _levelLab = [[UILabel alloc] initWithFrame:SARectMake(85, 25, 150, 20)];
        _levelLab.textColor = kPinkColor;
        _levelLab.font = kFont(13);
    }
    return _levelLab;
}

-(UILabel *)iphoneLab {
    if (!_iphoneLab) {
        _iphoneLab = [[UILabel alloc] initWithFrame:SARectMake(85, 45, 150, 20)];
        _iphoneLab.textColor = kBlackColor;
        _iphoneLab.font = kFont(13);
    }
    return _iphoneLab;
}

-(UIImageView *)allowImageV {
    if (!_allowImageV) {
        _allowImageV = [[UIImageView alloc] initWithFrame:SARectMake(345, 26, 10, 18)];
        _allowImageV.image = [UIImage imageNamed:@"vip_grayAllow"];
    }
    return _allowImageV;
}

-(UIImageView *)birthdayImageV {
    if (!_birthdayImageV) {
        _birthdayImageV = [[UIImageView alloc] initWithFrame:SARectMake(284, 17, 36, 36)];
        _birthdayImageV.image = [UIImage imageNamed:@"vip_birthday"];
    }
    return _birthdayImageV;
}

@end
